setInterval(function () {
    var i;
    for (i = 1; i < 2; i++) {
        getInData(i);
        // getOutData(i);
        // getTimeData(i);
        // getMsgData(i);

        setTimeout(function () {
            getOutData(i);
            setTimeout(function () {
                getTimeData(i);
                setTimeout(function () { getMsgData(i) }, 300);
            }, 300);
        }, 300);
    }
}, 2000); //update rate



function getInData(ID) {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function () {
        if (this.readyState == 4 && this.status == 200) {
            document.getElementById("InData" + ID).innerHTML =
                this.responseText;
        }
    };
    xhttp.open("GET", "InStatus?ID=" + ID, true);
    xhttp.send();
}

function getOutData(ID) {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function () {
        if (this.readyState == 4 && this.status == 200) {
            document.getElementById("OutData" + ID).innerHTML =
                this.responseText;
        }
    };
    xhttp.open("GET", "OutStatus?ID=" + ID, true);
    xhttp.send();
}

function getTimeData(ID) {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function () {
        if (this.readyState == 4 && this.status == 200) {
            document.getElementById("TimeData" + ID).innerHTML =
                this.responseText;
        }
    };
    xhttp.open("GET", "TimeStatus?ID=" + ID, true);
    xhttp.send();
}

function getMsgData(ID) {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function () {
        if (this.readyState == 4 && this.status == 200) {
            document.getElementById("Msg" + ID).innerHTML =
                this.responseText;
        }
    };
    xhttp.open("GET", "Othermsg?ID=" + ID, true);
    xhttp.send();
}



